<template>
	<view class="">
		<!-- 	<view class="row" v-for="item in listArr" :key="item.id">
			<image class="logo" :src="item.picurl"></image>
			<view class="text-area">
				{{item.title}}
			</view>
		</view> -->
		<!-- <view class="row" v-for="item in userArr" :key="item._id">
			<view class="">姓名：{{item.name}}</view>
			<view class="">性别：{{item.gender}}</view>
			<view class="">电话：{{item.tel}}</view>
			<view class="">邮箱：{{item.mail}}</view>
		</view> -->

		<!-- <form @submit="onSubmit">
			<input type="text" name="name" />
			<input type="text" name="tel" />
			<button form-type="submit">提交</button>
		</form> -->

		<view class="out">
			<view class="row" v-for="item in userArr" :key="item._id">
				姓名：{{item.name}}
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello',
				listArr: [],
				userArr: []
			}
		},
		onLoad() {
			// uniCloud.callFunction({
			// 	name: "myCloudFun",
			// 	data: {
			// 		num: 3
			// 	}
			// }).then(res => {
			// 	this.listArr = res.result
			// 	console.log(res);
			// })
			// uniCloud.callFunction({
			// 	name: "cloudDemo1",
			// 	data: {

			// 	}
			// }).then(res => {
			// 	this.userArr = res.result.data
			// 	console.log(res);
			// })
			this.getData()
		},
		methods: {
			onSubmit(e) {
				console.log(e);
				let obj = e.detail.value;
				uniCloud.callFunction({
					name: "cloudDemo1",
					data: obj
				}).then(res => {
					console.log(res);
				})
			},
			getData() {
				uniCloud.callFunction({
					name: "cloudDemoGet",
					data: {}
				}).then(res => {
					console.log(res);
					this.userArr = res.result.data
				})
			}
		}
	}
</script>

<style>
	.row {
		border-bottom: 1px solid #ccc;
		padding: 30rpx;
	}

	.out {
		padding: 30rpx;

		.row {
			border-bottom: 1px solid #ccc;
			padding: 20rpx 0;
		}
	}
</style>